package com.weido;

import com.weido.nettyServer.core.MiNiTomcat;
import com.weido.nettyServer.nettyMvc.NettyDispatcherServlet;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Application {

    public static void main(String[] args) {
        Application.run();
    }

    public static void run(){
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        MiNiTomcat tomcat = (MiNiTomcat) context.getBean("miNiTomcat");
        NettyDispatcherServlet  mvc = (NettyDispatcherServlet) context.getBean("nettyDispatcherServlet");
        mvc.init(context);
        try {
            tomcat.start();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
